package cn.ehcache.abstracts;

import org.ehcache.CacheManager;
import org.ehcache.config.builders.CacheManagerBuilder;


public class SimpleCacheManager {

    private static  CacheManager cacheManager;

    /**
     * 实例化一个cacheManager
     *
     * @return {@link CacheManager }
     **/
    public static CacheManager instants() {
        if (cacheManager == null) {
            synchronized (SimpleCacheManager.class) {
                if (cacheManager == null) {
                    cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
                            .build(true);
                    return cacheManager;
                }
            }
        }
        return cacheManager;
    }


}
